﻿using B.T.Smark.Infartructrue.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.T.Smark.Infartructrue.Implment
{
    public class BaseRepository<T>:IBaseRepository<T> where T : class
    {
        public BaseRepository(MyDbContext myDbContext)
        {
            MyDbContext = myDbContext;
        }

        public MyDbContext MyDbContext { get; }

        public IQueryable<T> GetAll()
        {
            return MyDbContext.Set<T>();
        }


        public async Task<int> UpdateRage(List<T> t)
        {
            MyDbContext.Set<T>().UpdateRange(t);
            return await MyDbContext.SaveChangesAsync();
        }
   
    }
}
